From: Jonas Ã…dahl Date: Thu, 10 Apr 2025 07:23:55 +0000 (+0200) Subject: keyboardManager: Adapt to layout API becoming async X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~124^2^2~98 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=af567cee115a38b78cc6432272b9121f323b7a42;p=gnome-shell.git keyboardManager: Adapt to layout API becoming async Part-of: --- diff --git a/js/misc/keyboardManager.js b/js/misc/keyboardManager.js index 78c487241..75d0aa32c 100644 --- a/js/misc/keyboardManager.js +++ b/js/misc/keyboardManager.js @@ -55,7 +55,7 @@ class KeyboardManager { this._currentKeymap = null; } - _applyLayoutGroup(group) { + async _applyLayoutGroup(group) { let options = this._buildOptionsString(); let [layouts, variants] = this._buildGroupStrings(group); let model = this._xkbModel; @@ -68,11 +68,16 @@ class KeyboardManager { return; this._currentKeymap = {layouts, variants, options, model}; - global.backend.set_keymap(layouts, variants, options, model); + await global.backend.set_keymap_async(layouts, variants, options, model, null); } - _applyLayoutGroupIndex(idx) { - global.backend.lock_layout_group(idx); + async _applyLayoutGroupIndex(idx) { + await global.backend.set_keymap_layout_group_async(idx, null); + } + + async _doApply(info) { + await this._applyLayoutGroup(info.group); + await this._applyLayoutGroupIndex(info.groupIndex); } apply(id) { @@ -82,10 +87,9 @@ class KeyboardManager { if (this._current && this._current.group === info.group) { if (this._current.groupIndex !== info.groupIndex) - this._applyLayoutGroupIndex(info.groupIndex); + this._applyLayoutGroupIndex(info.groupIndex).catch(logError); } else { - this._applyLayoutGroup(info.group); - this._applyLayoutGroupIndex(info.groupIndex); + this._doApply(info).catch(logError); } this._current = info; @@ -95,8 +99,7 @@ class KeyboardManager { if (!this._current) return; - this._applyLayoutGroup(this._current.group); - this._applyLayoutGroupIndex(this._current.groupIndex); + this._doApply(this._current).catch(logError); } setUserLayouts(ids) { diff --git a/js/ui/environment.js b/js/ui/environment.js index 64ee2b8e2..659c76338 100644 --- a/js/ui/environment.js +++ b/js/ui/environment.js @@ -31,6 +31,8 @@ Gio._promisify(Gio.DBusProxy.prototype, 'call_with_unix_fd_list'); Gio._promisify(Gio.File.prototype, 'query_info_async'); Gio._promisify(Polkit.Permission, 'new'); Gio._promisify(Shell.App.prototype, 'activate_action'); +Gio._promisify(Meta.Backend.prototype, 'set_keymap_async'); +Gio._promisify(Meta.Backend.prototype, 'set_keymap_layout_group_async'); // We can't import shell JS modules yet, because they may have // variable initializations, etc, that depend on this file's